/*
 * Wire
 * Copyright (C) 2018 Wire Swiss GmbH
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses/.
 *
 */

@keyframes anim {
  from {
    transform: translateX(~'calc(-100% - 32px)');
  }
  to {
    transform: translateX(0);
  }
}

.warning {
  position: absolute;
  z-index: @z-index-warnings;
  width: 100%;

  &.warning-dimmed {
    height: 100%;
    background-color: fade(#000, 64%);
  }
}

.warning-bar {
  position: absolute;
  display: flex;
  width: 100%;
  justify-content: center;
  background-color: var(--accent-color);
  color: var(--app-bg-secondary);

  a,
  button {
    color: var(--app-bg-secondary);
    &:hover,
    &:focus {
      color: var(--app-bg);
    }
  }
}

.warning-bar-feature {
  height: var(--warning-bar-feature-height);
}

.warning-bar-connection {
  .label-xs;

  height: var(--warning-bar-connection-height);
  justify-content: center;
}

.warning-bar-poor-call-quality {
  background-color: @w-red;
}

.warning-bar-click {
  cursor: pointer;
}

.warning-bar-progress {
  position: absolute;
  width: 100%;
  height: 4px;
  animation: anim 2.1s var(--ease-in-out-quart) infinite;
  background-color: @w-yellow;

  &::after {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: @w-yellow;
    content: '';
    transform: translateX(~'calc(100% + 32px)');
  }
}

.warning-bar-message {
  display: flex;
  align-items: center;
}

.warning-bar-spinner {
  margin-left: 8px;
  path {
    fill: #fff;
  }
}

.warning-bar-close {
  position: absolute;
  top: 50%;
  right: 24px;
  margin-top: calc((var(--button-medium-sm-height) / 2) * -1);
}

.warning-bar-icon {
  margin-right: 8px;
  font-size: var(--icon-size-md);
  line-height: var(--icon-size-md);

  svg {
    width: var(--icon-size-md);
    height: var(--icon-size-md);

    path {
      fill: #fff;
    }
  }
}

.warning-bar-link {
  cursor: pointer;

  &,
  &:hover,
  &:active {
    color: #fff;
    text-decoration: underline;
    text-transform: inherit;
  }
}
